package academic.ui.client.event;

import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.GwtEvent;
import com.gwtplatform.mvp.client.EventBus;

public class NameChangeEvent extends GwtEvent<NameChangedEventHandler>{

	
	private static final Type<NameChangedEventHandler> TYPE = new Type<NameChangedEventHandler>();
	
	public NameChangeEvent(String newName) {
		this.newName=newName;
	}

	public static Type<NameChangedEventHandler> getType() {
		return TYPE;
	}
	private String newName;
	
	public static void fire(EventBus eventBus,String newName) {
		eventBus.fireEvent(new NameChangeEvent(newName));
	}
	
	@Override
	protected void dispatch(NameChangedEventHandler handler) {
		handler.onNameChangeEvent(this);
	}

	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<NameChangedEventHandler> getAssociatedType() {
		return getType();
	}

	public void setNewName(String newName) {
		this.newName = newName;
	}

	public String getNewName() {
		return newName;
	}

}
